﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hopscotch.Common;

namespace Hopscotch.Presentation.Configuration
{
    [DebuggerDisplay("EnvironmentId={EnvironmentId}; LocationId={LocationId}, Name={Name}")]
    public class EnvironmentConfigurationElement : ConfigurationElement, IEnvironmentConfiguration
    {
        [ConfigurationProperty("id")]
        public string EnvironmentId
        {
            get
            {
                return base["id"] as string;
            }
        }

        [ConfigurationProperty("location")]
        public string LocationId
        {
            get
            {
                return base["location"] as string;
            }
        }

        [ConfigurationProperty("name")]
        public string Name
        {
            get
            {
                return base["name"] as string;
            }
        }

        [ConfigurationProperty("signalRHub")]
        public string SignalRHubAddress
        {
            get
            {
                return base["signalRHub"] as string;
            }
        }

        [ConfigurationProperty("wcfConfigFile")]
        public string WcfClientConfigFile
        {
            get
            {
                return base["wcfConfigFile"] as string;
            }
        }

        public EnvironmentKey CreateEnvironmentKey()
        {
            return new EnvironmentKey(this.EnvironmentId, this.LocationId);
        }
    }
}
